﻿<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp"%>
<%!
/**
 * 病人取消预约信息 对应的存储过程名称 -》病人取消预约信息
 */
	public Message undoPatientAppoint(Map<String, String> param) {
		Connection connection = null;
		java.sql.CallableStatement statement = null;
		Message msg = new Message(0, "操作成功");
		java.sql.ResultSet rs = null;
		try {
			connection = getConn();
			statement = connection.prepareCall("{ call 写病人预约信息(?,?,?,?) }");
			statement.setString(1, Tools.getDesc(param.get("lb"), "05"));
			statement.setString(2, Tools.getDesc(param.get("str1"), ""));
			statement.setString(3, Tools.getDesc(param.get("str2"), "00")); 
			statement.setString(4, Tools.getDesc(param.get("str3"), ""));   
	 		rs = statement.executeQuery();
			String state = "";
			String message = "";
			while(rs.next()){
				state=rs.getString(1);
				message=rs.getString(2);
			}
			if("F".equalsIgnoreCase(state)) {
				msg.put("errcode",FAILURE);
				msg.put("errmsg",message);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
					if(rs != null)
						rs.close();
					if (statement != null)
						statement.close(); 
					if (connection != null)
						connection.close(); 
				} catch (Exception e) {
					rs=null;
					statement=null;
					connection=null;
					e.printStackTrace();
				}
			return msg;
		}
	}
%>

<%
	Message msg = new Message();
	try {
			String lb       = Tools.getDesc(input.getDesc("lb","05"));                
			String sn     = Tools.getDesc(input.getDesc("sn",""));          
			String str2     = Tools.getDesc(input.getDesc("str2", "00"));      
			String mark     = Tools.getDesc(input.getDesc("mark", ""));              
			
			//病人取消预约信息
			Map<String, String> param  = new HashMap<String,String>(4);
			param.put("lb",lb);                   
			param.put("str1",sn);                 
			param.put("str2",str2);                  
			param.put("str3",mark);                      
			msg = undoPatientAppoint(param);
		} catch (Exception e){
	   	msg.put("errcode",FAILURE);
    }
		out.println(msg);
%>